<template>
  <div class="contract__list-container">
    <van-checkbox-group v-model="checkboxGroup" @change="onChange">
      <div
        v-for="(contract,index) in contractList"
        :key="index"
        :name="index"
        class="contract-card"
      >
        <van-row>
          <van-col span="2">
            <van-checkbox :name="contract.vbillcode" checked-color="#F44336" icon-size="16px"></van-checkbox>
          </van-col>
          <van-col span="22">
            <contract-item :contract="contract"></contract-item>
          </van-col>
        </van-row>
      </div>
    </van-checkbox-group>
    <van-divider class="tip-text">已为您加载全部数据</van-divider>
  </div>
</template>

<script>
import ContractItem from "./ContractItem";
export default {
  props: {
    contractList: Array,
  },
  data() {
    return {
      checkboxGroup: [],
    };
  },
  components: {
    ContractItem,
  },
  mounted() {
    console.log("111111");
    console.log(this.contractList);
  },
  methods: {
    onChange(){
      this.$emit("onChange",this.checkboxGroup);
    },
  },
};
</script>

<style scoped>
.contract__list-container {
  padding: 10px;
}
.contract-card {
  background-color: #ffffff;
  margin-bottom: 8px;
  padding: 10px;
  border-radius: 2px;
}

.tip-text {
  font-size: 12px;
  color: #c5cad5;
}
</style>